package com.hd.assistant.biz.service.exception;

import com.hd.assistant.biz.util.OpenApiException;



public class ServiceException extends Exception {
	
	private static final long serialVersionUID = 8243127099991355146L;
	
	
	public String displayError ;
	
	public boolean needReLogin;

	public boolean isNeedReLogin() {
		return needReLogin;
	}

	public void setNeedReLogin(boolean needReLogin) {
		this.needReLogin = needReLogin;
	}

	public String getDisplayError() {
		return displayError;
	}

	public void setDisplayError(String displayError) {
		this.displayError = displayError;
	}

	public ServiceException( String msg) {
		super(msg);
		displayError = msg;
	}

	public ServiceException(String msg, Exception ex) {
		super(msg,ex);
		if(ex instanceof OpenApiException){
			OpenApiException e = (OpenApiException)ex;
			if(e.getErrorCode() == OpenApiException.NO_ORDERED){
				displayError = "对不起，该账户应用未订购或授权！";
			}
			if(e.getErrorCode() == OpenApiException.NO_LOGIN_ERROR ){
				needReLogin = true;
			}
		}

	}

}
